package com.hnxxxy.statistics.controller;


import com.hnxxxy.statistics.service.TypeMapService;
import com.hnxxxy.sysmgr.pojo.Staff;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

/**
 *
 * @author：zqh
 * @Phone：17680560413
 * @E-mail：205757245@qq.com
 * @date:2020年6月25日11:40:30
 */

@Controller
@RequestMapping("/pertype")
public class TypeMapController {

    @Autowired
    private TypeMapService perTypeMapService;

    @RequestMapping("/topertypepie")
    public String toPerTypepie(){
        return "/statistics/perpie";
    }

    @RequestMapping("/tocollegetypepie")
    public String toCollegeTypepie(){
        return "/statistics/collegepie";
    }


    @RequestMapping("/findpertypepie")
    @ResponseBody
    public Map<String, Object> findPerTypePie(){
        //通过shiro获取用户信息
        Subject subject= SecurityUtils.getSubject();
        Staff staff= (Staff) subject.getPrincipal();
        return perTypeMapService.findPerTypePie(staff.getUserid());
    }

    @RequestMapping("/findpertypebroken")
    @ResponseBody
    public Map<String, Object> findPerTypeBroken(){
        //通过shiro获取用户信息
        Subject subject= SecurityUtils.getSubject();
        Staff staff= (Staff) subject.getPrincipal();
        return perTypeMapService.findPerTypePie(staff.getUserid());
    }


    @RequestMapping("/findcollegetypepie")
    @ResponseBody
    public Map<String, Object> findCollegeTypePie1(){
        return perTypeMapService.findCollegeTypePie();
    }


}
